import os
from celery import Celery, platforms

os.environ.setdefault('FORKED_BY_MULTIPROCESSING', '1')


def create_celery_app():
    """
    Celery 异步任务
    :return:
    """
    celery_app = Celery("mg_task")
    platforms.C_FORCE_ROOT = True

    celery_app.config_from_object("celery_task.conf")

    return celery_app


celery_app = create_celery_app()
